package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @program: yygh_parent
 * @author: Mr.Zhuo
 * @create: 2022-03-15 21:20
 **/
@Api(description = "阿里云文件管理")
@RestController
@RequestMapping("/admin/oss/file")
public class FileController {

    @Autowired
    private FileService fileService;


    @ApiOperation(value = "文件上传")
    @PostMapping("upload")
    public R upload(MultipartFile file) {
        String url = fileService.upload(file);

        return R.ok().message("文件上传成功").data("url",url);
    }
}
